package com.itheima.sh.user.Controller;

import com.itheima.sh.pojo.Order;
import com.itheima.sh.pojo.User;
import com.itheima.sh.request.dtos.UserOrderDTO;
import com.itheima.sh.response.vos.OrderVo;
import com.itheima.sh.response.vos.UserOrderVo;
import com.itheima.sh.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/findUserById")
    public List<User> findUserById(@RequestParam("username") String username){

        return userService.findUserById(username);
    }

//    @GetMapping("/findOrderByUserId/{username}")
    @PostMapping("/findOrderByUserId")
    public UserOrderVo findOrderByUserId(@RequestBody UserOrderDTO username){
        return userService.findOrderByUserId(username);
    }

}
